<template>
  <div class="slot">
    <h3>插槽传参demo</h3>
    <p>插槽分为：默认插槽、具名插槽和作用域插槽3种类型</p>
    <Slot>
      <div>这里显示默认插槽信息</div>
      <template v-slot:video>
        <!-- 具名插槽可以简写成#video -->
        <div>这里显示音乐信息</div>
      </template>
    </Slot>

    <Scope :todos="todos">
      <template v-slot="{ $row, $index }">
        <p :style="{ color: $row.done ? 'green' : 'red' }">{{ $row.text }}--{{ $index }}</p>
      </template>
    </Scope>
    <el-pagination
      v-model:current-page="currentPage4"
      v-model:page-size="pageSize4"
      :page-sizes="[100, 200, 300, 400]"
      :small="small"
      :disabled="disabled"
      :background="background"
      layout="total, sizes, prev, pager, next, jumper"
      :total="400"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import Scope from './Scope.vue'

const todos = ref([
  { id: 1, text: '吃饭', done: true },
  { id: 2, text: '睡觉', done: false },
  { id: 3, text: '打豆豆', done: true },
])
import Slot from './Slot.vue'
</script>

<style scoped>
.slot {
  width: 600px;
  height: 600px;
  background: lightblue;
}
</style>
